<template>
  <div>
    <el-menu
        style="width: 200px;min-height: calc(100vh - 50px)"
        default-active="customer"
        router
        class="el-menu-vertical-demo"
    >
      <el-sub-menu index="1">
        <template #title>系统管理</template>
        <el-menu-item index="user" route="" @click="panduan1">员工管理</el-menu-item>
        <el-menu-item index="customer">客户管理</el-menu-item>
        <el-menu-item index="project" @click="panduan2">项目资料管理</el-menu-item>
      </el-sub-menu>
    </el-menu>
  </div>
</template>
<script>
import {Location} from '@element-plus/icons'

export default {
  name: "Aside",
  components: {
    Location
  },
  methods:{
    panduan1(){
      console.log("进来了")
      var user = JSON.parse(sessionStorage.getItem("user"))
      if(user.role == 1){
        this.$router.push("/user")
      }
      else{
        this.$router.push("/customer")
        this.$message({
          type:"error",
          message:"权限不够，请联系管理员"
        })
      }
    },
    panduan2(){
      console.log("进来了")
      var user = JSON.parse(sessionStorage.getItem("user"))
      if(user.role == 1){
        this.$router.push("/project")
      }
      else{
        this.$router.push("/customer")
        this.$message({
          type:"error",
          message:"权限不够，请联系管理员"
        })
      }
    },
  }

}
</script>

<style scoped>

</style>